<template>
  <div class="shareList" @click="show()">
    <div class="gary" v-if="showon==0">
    </div>
    <div class="divpic">
      <img fit="cover"  :src="require(`../../../../assets/shareflower/sharePicture/${this.pic}`)" alt="" />
    </div>
    <div class="bottom">
      <div class="title">{{ title }}</div>
        <div class="explain">
          <div class="user" @click="getShareByUserId">
            <img :src="require(`../../../../assets/shareflower/shareUserPicture/${this.userpic}`)" alt="" />
            {{ userName }} 
          </div>
          <!-- <div class="like" @click="getLike">
            <img :src="love?require('../../public/shareIcon/Cardiotype-1.png'):require('../../public/shareIcon/Cardiotype.png')"  alt="" />
            <div class="like2">{{ like }}</div>
          </div> -->
        </div>
    </div>
   
    <div class="id">{{ id }}</div>
  </div>
  
</template>

<script>
export default {
  props: ["showon", "pic", "title", "userpic", "userName", "like", "love", "id"],
  data() {
    return {
      share_userId: '',
    }
  },
  beforeUpdate() {
    console.log(this.pic);
    console.log(this.userpic);
  },
  methods: {
    // getLike() {
    //   this.$emit('getLike');
    // },
    getShareByUserId() {
      this.$emit('getShareByUserId');
    },
    show() {
      console.log(this.id);
      this.$router.push({
        path: 'square-main',
        query:{id:this.id}
      })
    },
  }
};
</script>

<style lang="scss" scoped>
.gary{
  background-color: #333;
  position: absolute;
  width: 100%;
  height: 100%;
}
.shareList {
  border: 0.2px solid #999;
  &:hover{
    border:0.2px solid transparent;
    box-shadow: 0 0 2px;
  }
  overflow: hidden;
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  .id{
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    color:aliceblue;
    background-color: #777;
    display: inline-block;
    width:20px;
    text-align: center;
  }
  
  > .divpic {
    width: 100%;
  height: 40%;
    top: 0;
    // border-radius:5px;
    // height:60%;
    position: relative;
    overflow: hidden;
    > img {
      //  border-radius:5px;
      display: block;
  //     width: 11rem;
  // height: 12rem;
      width: 100%;
      // height: 100%;
    //   width: 170px;
    // height: 170px;
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
    }
  }
  .bottom{
    height: 6rem;
     >.title {
    
      height: 1.9rem;
      margin:  0.2rem;
    font-size: 0.3rem;
    color: #333;
    text-overflow: -o-ellipsis-lastline;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    }
  > .explain {
    width: 100%;
    display: flex;
    text-align: center;
    > .user {
      font-size: 0.8rem;
      color: rgb(193, 117, 19);
      user-select: none;
      margin: 0.3rem;
      display: flex;
      align-items: center;
      width: 100%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis; 
      > img {
        width: 2rem;
        height: 2rem;
        display: block;
        border-radius: 100px;
        margin-right: 0.4rem;
      }
    }}
    } 
  }

</style>
